Skip to content

[codex] Preserve mobile composer draft failures - #3348

Merged
juliusmarminge merged 1 commit into
mainfrom
codex/mobile-composer-draft-errors
Jun 20, 2026
Merged

[codex] Preserve mobile composer draft failures#3348
juliusmarminge merged 1 commit into
mainfrom
codex/mobile-composer-draft-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add structured composer-draft persistence errors with operation and storage path context
  • preserve exact causes for read, JSON, write, and hydration failures
  • retain best-effort draft behavior while making ignored failures observable

Verification

  • vp test apps/mobile/src/state/use-composer-drafts.test.ts
  • vp check
  • vp run typecheck
  • vp run lint:mobile

Note

Low Risk
Observability-only changes to local draft file handling; no change to user-facing draft semantics or security-sensitive flows.

Overview
Adds ComposerDraftPersistenceError (Effect Schema.TaggedErrorClass) so mobile composer draft file I/O failures carry operation (open, read, decode, encode, write, hydrate), storage path, and the original cause.

Load, debounced save, and hydration paths still fail open (empty drafts / in-memory state unchanged), but silent catch blocks are replaced with console.warn that logs the tagged error. Writes now wrap failures in the structured error before the existing best-effort save handler logs them.

Reviewed by Cursor Bugbot for commit 0adc3f6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Preserve mobile composer draft failures with structured error logging

  • Introduces ComposerDraftPersistenceError, a tagged error class with fields for operation, directory, fileName, and cause, thrown by writePersistedComposerDrafts on open/encode/write failures.
  • loadPersistedComposerDrafts now catches and wraps failures in ComposerDraftPersistenceError and emits a console warning, still returning an empty object on failure.
  • savePersistedComposerDrafts and ensureComposerDraftsLoaded log console warnings on failure but continue to treat persistence as best-effort and do not rethrow.
  • Changes are isolated to use-composer-drafts.ts.

Macroscope summarized 0adc3f6.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ea4b48aa-aa1f-4e34-8b0a-dbc024c81350

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mobile-composer-draft-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured error handling and logging for composer draft persistence failures. No functional behavior changes - only improved error visibility for debugging purposes.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit 30a084c into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/mobile-composer-draft-errors branch June 20, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant